/*
 * @Author: fanjs
 * @Date: 2025-03-05 13:13:36
 * @Description: 通用常量
 */

export const mails = [
  { key: "163.com", label: "网易163邮箱" },
  { key: "qq.com", label: "腾讯QQ邮箱" },
  { disabled: true, key: "126.com", label: "网易126邮箱" },
  { disabled: true, key: "139.com", label: "网易139邮箱" },
  { disabled: true, key: "gmail.com", label: "谷歌Gmail邮箱" },
  { disabled: true, key: "outlook.com", label: "Outlook邮箱" },
  { disabled: true, key: "yahoo.com", label: "Yahoo邮箱" },
  { disabled: true, key: "hotmail.com", label: "Hotmail邮箱" },
];

// 协议类型
export type ProtocolType = "SMTP" | "POP" | "IMAP";
export const protocols = [
  { key: "SMTP", label: "SMTP" },
  { key: "POP", label: "POP3" },
  { key: "IMAP", label: "IMAP" },
];

// 收件人状态
export const recipients_status = [
  { key: "pending", label: "待发送" },
  { key: "sent", label: "已发送" },
  { key: "failed", label: "发送失败" },
];

// 状态颜色映射
export type RecipientsStatus = "pending" | "sent" | "failed";
const statusColorMap: Record<RecipientsStatus, string> = {
  pending: "default",
  sent: "secondary",
  failed: "danger",
};

// 状态名称映射
const statusNameMap: Record<RecipientsStatus, string> = {
  pending: "待发送",
  sent: "已发送",
  failed: "发送失败",
};

// 获取状态颜色的函数
export const formatStatus = (status: string, isName?: boolean): any => {
  if (isName) return statusNameMap[status as RecipientsStatus]
  else return statusColorMap[status as RecipientsStatus] || "default"; // 默认颜色
};